<template>
  <base-breadcrumb>
    <a-form-model
      ref="form1"
      :model="form"
      :rules="rules"
    >
      <a-card
        :body-style="{ padding: '24px 32px' }"
        :bordered="false"
      >
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="工程承包模式"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="contractModelCode"
            >
              <BaseInput
                v-model="form.contractModelName"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="是否内部分包"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="innerPackageCode"
            >
              <BaseInput
                v-model="form.innerPackageName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            v-if="isContract"
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="专业承包公司"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="contractBranchs"
            >
              <BaseInput
                v-model="form.contractBranchName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>

          <a-col
            v-if="isGeneral"
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="总承包单位"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="generalContractorCompanyName"
            >
              <BaseInput
                v-model="form.generalContractorCompanyName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="项目名称"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="projectName"
            >
              <BaseInput
                v-model="form.projectName"
                placeholder="输入项目名称"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="项目简称"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="projectOmit"
            >
              <BaseInput
                v-model="form.projectOmit"
                placeholder="输入项目简称"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="项目编号"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.projectNum"
                placeholder="项目编号"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="一级地域"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="oneArea"
            >
              <BaseInput
                v-model="form.oneAreaName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="二级地域"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="secondArea"
            >
              <BaseInput
                v-model="form.secondAreaName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="三级地域"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="threeArea"
            >
              <BaseInput
                v-model="form.threeAreaName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="四级地域"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="fourArea"
            >
              <BaseInput
                v-model="form.fourAreaName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="地理坐标"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="longitude"
            >
              <BaseInputNumber
                v-model="form.longitude"
                style="margin-right: 20px;width: 90px !important;"
                placeholder="经度"
                disabled
              />
              <BaseInputNumber
                v-model="form.latitude"
                style="width: 90px !important;"
                placeholder="纬度"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <!--<a-col :md="8" :sm="8">-->
          <!--<a-form-model-item-->
          <!--label="详细地址"-->
          <!--:labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"-->
          <!--:wrapperCol="{ lg: { span: 17}, sm: { span: 17 } }" prop="projectAddress">-->
          <!--<BaseInput-->
          <!--v-model="form.projectAddress"-->
          <!--placeholder="输入详细地址 "-->
          <!--type="textarea"/>-->
          <!--</a-form-model-item>-->
          <!--</a-col>-->
        </a-row>

        <a-row :gutter="24">
          <a-col
            :md="24"
            :sm="24"
          >
            <a-form-model-item
              label="详细地址"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17}, sm: { span: 17 } }"
              prop="projectAddress"
            >
              <BaseInput
                v-model="form.projectAddress"
                placeholder="输入详细地址 "
                type="textarea"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="区域一级管辖单位(所属办事处)"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="jurisdictionOneCode"
            >
              <BaseInput
                v-model="form.jurisdictionOneName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="区域二级管辖单位(所属办事处)"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="jurisdictionTwoCode"
            >
              <BaseInput
                v-model="form.jurisdictionTwoName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>

        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="承接名义"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="undertakeCode"
            >
              <BaseInput
                v-model="form.undertakeName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="实施单位(所属二级单位)"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="implementationTwo"
            >
              <BaseInput
                v-model="twoCompany"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="实施单位(所属三级单位)"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="implementationThree"
            >
              <BaseInput
                v-model="form.implementationThreeName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="项目类型"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="projectTypeCode"
            >
              <BaseInput
                v-model="form.projectTypeName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="项目业态"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.projectFormatName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="结构类型"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="structureTypeCode"
            >
              <BaseInput
                v-model="form.structureTypeName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="项目重要程度"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="projectImportanceCode"
            >
              <BaseInput
                v-model="form.projectImportanceName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="是否为重点项目"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="keyProjectsCode"
            >
              <BaseInput
                v-model="form.keyProjectsName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="局级大客户"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="bureauCustomerCode"
            >
              <BaseInput
                v-model="form.bureauCustomerName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="公司级大客户"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="companyCustomerCode"
            >
              <BaseInput
                v-model="form.companyCustomerName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="客户级别"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop=""
            >
              <BaseInput
                v-model="form.customerLevelName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="设计单位名称"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="designUnitName"
            >
              <BaseInput
                v-model="form.designUnitName"
                placeholder=" 输入设计单位名称"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="建设单位名称"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="constructionName"
            >
              <BaseInput
                v-model="form.constructionName"
                placeholder="输入建设单位名称 "
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="建设单位性质"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="constructionNatureCode"
            >
              <BaseInput
                v-model="form.constructionNatureName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="建设单位社会统一信用代码"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="constructionCode"
            >
              <BaseInput
                v-model="form.constructionCode"
                placeholder=" 建设单位社会统一信用代码"
                disabled
                style="width: 100%;"
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="审计单位名称"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="auditName"
            >
              <BaseInput
                v-model="form.auditName"
                placeholder=" 审计单位名称"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="监理单位名称"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="supervisionName"
            >
              <BaseInput
                v-model="form.supervisionName"
                placeholder="输入监理单位名称 "
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="勘察单位名称"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.surveyName"
                placeholder="输入勘察单位名称"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="咨询单位名称"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.consultingName"
                placeholder="输入咨询单位名称 "
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="是否签订合同"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="contractCode"
            >
              <a-radio-group v-model="form.contractCode">
                <a-radio :value="1">
                  已签订
                </a-radio>
                <a-radio :value="0">
                  未签订
                </a-radio>
              </a-radio-group>
            </a-form-model-item>
          </a-col>
          <a-col
            v-if="isContractMileage"
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="合同工程里程(km)"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="contractMileage"
            >
              <BaseInputNumber
                v-model="form.contractMileage"
                placeholder="合同工程里程"
                style="width: 100%"
              />
            </a-form-model-item>
          </a-col>

          <a-col
            v-if="isConstruction"
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="合同建筑面积-地上(万m2)"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="contractAreaGround"
            >
              <BaseInputNumber
                v-model="form.contractAreaGround"
                style="width: 100%"
                placeholder="合同建筑面积-地上(万m2)"
                @change="groundArea"
              />
            </a-form-model-item>
          </a-col>

          <a-col
            v-if="isConstruction"
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="合同建筑面积-地下(万m2)"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="contractAreaUnderground"
            >
              <BaseInputNumber
                v-model="form.contractAreaUnderground"
                style="width: 100%"
                placeholder="合同建筑面积-地下(万m2)"
                @change="ungroundArea"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row
          v-if="isConstruction"
          :gutter="24"
        >
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="地上层数"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="groundFloor"
            >
              <BaseInputNumber
                v-model="form.groundFloor"
                style="width: 100%"
                placeholder="请输入地上层数"
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="地下层数"
              style="width: 100%"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="undergroundFloor"
            >
              <BaseInputNumber
                v-model="form.undergroundFloor"
                style="width: 100%"
                placeholder="请输入地下层数"
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="合同建筑总面积(万m2)"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop=""
            >
              <BaseInputNumber
                v-model="totalArea"
                disabled
                style="width: 100%"
                placeholder="合同建筑总面积(万m2) "
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="合同单体工程个数"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="contractSingleProject"
            >
              <BaseInputNumber
                v-model="form.contractSingleProject"
                style="width: 100%"
                placeholder=" "
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="最高(长)单位工程米数(Km)"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="engineeringMeters"
            >
              <BaseInputNumber
                v-model="form.engineeringMeters"
                style="width: 100%"
                name="name"
                placeholder="最高（长）单位工程米数(Km)"
              />
            </a-form-model-item>
          </a-col>
          <!--<a-col :md="8" :sm="8">-->
          <!--<a-form-model-item-->
          <!--label="维保期时间(年)"-->
          <!--:labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"-->
          <!--:wrapperCol="{ lg: { span: 17 }, sm: { span: 17 } }">-->
          <!--<BaseInputNumber-->
          <!--style="width: 100%"-->
          <!--v-decorator="['maintenanceTime',  { rules: [{ required: true, message: ' ' }] }]"-->
          <!--name="name"-->
          <!--placeholder=""/>-->
          <!--</a-form-model-item>-->
          <!--</a-col>-->
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="合同开工日期"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="contractStartDate"
            >
              <a-date-picker
                v-model="form.contractStartDate"
                format="YYYY-MM-DD"
                placeholder="请选择日期"
                @change="getContractStartDate"
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="合同竣工日期"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="contractEndDate"
            >
              <a-date-picker
                v-model="form.contractEndDate"
                format="YYYY-MM-DD"
                placeholder="请选择日期"
                @change="getContractEndDate"
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="合同工期"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop=""
            >
              <BaseInput
                v-model="form.contractDays"
                disabled
                placeholder="合同工期"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="合同额(万)"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="contractValue"
            >
              <BaseInputNumber
                v-model="form.contractValue"
                style="width: 100%"
                placeholder=" "
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="自有施工合同额"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="ownerContractValue"
            >
              <BaseInputNumber
                      :precision="2"
                v-model="form.ownerContractValue"
                style="width: 100%"
                placeholder="自有施工合同额（万）"
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="备案项目经理"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
              prop="projectManager"
            >
              <a-select
                v-model="form.projectManager"
                show-search
                :filter-option="filterOption"
                label-in-value
                @change="getManagerName"
              >
                <a-select-option
                  v-for="item in projectManagers"
                  :key="item.id"
                  :value="item.id"
                >
                  {{ item.name }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="12"
            :sm="12"
          >
            <a-form-model-item
              label="项目特点或难点"
              :label-col="{ lg: { span: 7 }, sm: { span:7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.projectFeatures"
                placeholder="项目特点或难点"
                type="textarea"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="12"
            :sm="12"
          >
            <a-form-model-item
              label="主施工范围"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.mainScope"
                placeholder="主施工范围"
                type="textarea"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="12"
            :sm="12"
          >
            <a-form-model-item
              label="计划创优级别"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.excellencePlanName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="12"
            :sm="12"
          >
            <a-form-model-item
              label="计划观摩级别"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.observePlanName"
                type="text"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="12"
            :sm="12"
          >
            <a-form-model-item
              label="计划创优内容"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.excellentContent"
                placeholder="计划创优内容"
                type="textarea"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="12"
            :sm="12"
          >
            <a-form-model-item
              label="计划观摩内容"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.observeContent"
                placeholder="计划观摩内容"
                type="textarea"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="项目设计管理类别"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.designName"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="项目科技管理类别"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.technologyName"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-model-item
              label="项目类别（质量）"
              :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
              :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
            >
              <BaseInput
                v-model="form.qualityName"
                disabled
              />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-card>

      <div style="float:right;margin-top: 20px;margin-bottom: 20px;">
        <a-button
          type="primary"
          style="margin-right: 20px"
          :loading="loading"
          @click="submit"
        >
          提交
        </a-button>
        <a-button
          type="primary"
          @click="goBack"
        >
          关闭
        </a-button>
      </div>
    </a-form-model>
  </base-breadcrumb>
</template>

<script>
import FooterToolBar from '@/components/FooterToolbar'
import {
  getDataDicts,
  addProjectsInfo,
  getCustomerDicts,
  getAreadicts,
  getProjectManager,
  getProjectNum,
  getImCompany,
  getProjectsDel,
  getProjectFrom,
  getDepartConfig,
  addDepartmentConfig,
  getRegions
} from '@/api/project/projects'
import { getOrgUsers } from '@/api/commons'
import { getCompany } from '@/api/themeChoose/themeChoose'

export default {
  name: 'AddProjects',
  components: {
    FooterToolBar
  },
  props: {
    text: String
  },

  data() {
    return {
      employeeMultiSelect: false, // 员工多选
      form: {
        keyProjectsCode: '', // 是否为重点项目
        projectFormatName: ''
      },
      loading: false,
      rules: {
        contractCode: [{ required: true, message: '请选择是否签订合同', trigger: 'change' }],
        contractMileage: [{ required: true, message: '请输入合同工程里程', trigger: 'blur' }],
        contractAreaGround: [{ required: true, message: '请输入合同建筑面积-地上(万m2)', trigger: 'blur' }],
        contractAreaUnderground: [{ required: true, message: '请输入合同建筑面积-地下(万m2)', trigger: 'blur' }],
        groundFloor: [{ required: true, message: '请输入地上层数', trigger: 'blur' }],
        contractStartDate: [{ required: true, message: '请选择合同开工日期', trigger: 'blur' }],
        contractEndDate: [{ required: true, message: '请选择合同竣工日期', trigger: 'blur' }],
        undergroundFloor: [{ required: true, message: '请输入地下层数', trigger: 'blur' }],
        contractSingleProject: [{ required: true, message: '请输入合同单体工程个数', trigger: 'blur' }],
        engineeringMeters: [{ required: true, message: '请输入最高(长)单位工程米数(Km)', trigger: 'blur' }],
        contractValue: [{ required: true, message: '请输入合同额(万)', trigger: 'blur' }],
        ownerContractValue: [{ required: true, message: '请输入自有施工合同额(万)', trigger: 'blur' }],
        projectManagerCode: [{ required: true, message: '请选择备案项目经理', trigger: 'blur' }]
      },

      // 附件上传
      listUrl: '/cscec-project-business/file/business/project-fileQuery',
      deleteUrl: '/cscec-project-business/file/business/project-fileDelete',
      uploadList: '/cscec-project-business/file/business/fileUpload',
      businessId: '',

      ungroundAreas: 0,
      totalArea: 0, // 合同建筑总面积
      groundAreas: 0, // 地上面积

      mdl: null, // 数据
      projectModecode: '', // 工程承包模式code
      projectModeId: '', // 工程承包模式
      isContract: false, // 专业承包分公司
      isGeneral: false, // 总承包公司

      editable: false,

      nextSteps: '1',

      selectDatas: {}, // 立项返回下拉数据

      editingKey: '',
      selectedRowKeys: [],
      value: 1, // 是否签订合同

      previewImage: '',

      // data:[{postName:'项目经理', employeeName:'张三',employeeNum:'231231'}],

      projectManagers: [],
      isContractMileage: false, // 线性基础数据
      isConstruction: true, // 房建

      projectId: '', // 提交项目立项返回id
      projectManagerCodeName: '', // 备案项目经理名称
      twoCompany: '', // 实施单位二级
      levelName: '', // 客户级别
      startDate: '', //  开始时间
      endDate: '', //    结束时间

      countDate: 0, // 合同总工期,
      employeeNum: '', // 项目部设置人员调整员工编号
      employees: [], //设置的项目部人员信息

      projectPost: [], // 项目人员岗位设置
      otherPost: [], //  其他人员岗位设置

      contractingBranchs: [], // 专业承包分公司

      ispackage: '', // 是否外包

      queryData: {
        orgId: '',
        pageNumber: 1,
        pageSize: 99999
      }
    }
  },
  created() {
    this.getProjectManager()

    this.projectId = this.$route.query.projectId
    this.businessId = this.projectId

    localStorage.setItem('projectId', this.projectId)

    let getProjectId = this.projectId
    this.getCompany()
    if (getProjectId != null) {
      // this.getProjectDels(getProjectId)
      setTimeout(() => {
        this.getProjectDels(getProjectId)
      }, 20)
    }
  },
  computed: {
    hasSelected() {
      return this.selectedRowKeys.length > 0
    }
  },
  methods: {
    getCompany() {
      // const userInfo = Vue.getAcloudProvider().getUserInfo()
      // const orgIds = userInfo.employee&&userInfo.employee.posts.map(p=>p.orgId)
      let that = this
      getCompany({ tagCodes: ['BC', 'CO'] }).then((res) => {
        that.company = [] // res.data
        res.data.forEach((d) => {
          if (d.tagCode === 'BC') {
            that.company.push(d)
          } else if (d.tagCode === 'CO') {
            that.twoCompany = d.orgName
            // that.implementationTwo = {key:d.orgId,label:d.orgName}
            that.form.implementationTwo = { key: d.orgId, label: d.orgName }
          }
        })
      })
    },
    filterOption(input, option) {
      return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
    },
    goBack() {
      this.$router.push({ path: '/project/lists' })
    },

    submit() {
      // 提交
      this.saveInfo()
    },
    groundArea(value) {
      this.form.contractAreaGround = value

      this.totalArea = parseFloat(parseFloat(this.ungroundAreas) + parseFloat(value)).toFixed(8)
    },
    ungroundArea(value) {
      this.form.contractAreaUnderground = value
      this.totalArea = parseFloat(parseFloat(this.form.contractAreaGround) + parseFloat(value)).toFixed(8)
    },

    // 根据id获取项目详情信息
    getProjectDels(getProjectId) {
      getProjectsDel({ projectId: getProjectId }).then((res) => {
        this.form = res.data

        if (this.form.contractModelCode == 'zycb' && this.form.innerPackageCode == 0) {
          this.isGeneral = true // 总承包
          this.isContract = false // 专业承包
        }
        if (this.form.contractModelCode == 'zycb' && this.form.innerPackageCode == 1) {
          this.isGeneral = false // 总承包
          this.isContract = true // 专业承包
        }
        if (this.form.contractModelCode != 'zycb' && this.form.innerPackageCode == 1) {
          this.isGeneral = false // 总承包
          this.isContract = true // 专业承包
        }
        if (this.form.contractModelCode != 'zycb' && this.form.innerPackageCode == 0) {
          this.isGeneral = false // 总承包
          this.isContract = false // 专业承包
        }

        this.form.projectManager = {
          key: this.form.projectManagerCode,
          label: this.form.projectManagerName
        }

        this.totalArea = parseFloat(
          parseFloat(this.form.contractAreaUnderground) + parseFloat(this.form.contractAreaGround)
        ).toFixed(8)
        // calculateTypeCode   // 项目类型计算方式

        if (this.form.calculateTypeCode == '0') {
          this.isContractMileage = false
          this.isConstruction = true
        } else {
          this.isContractMileage = true
          this.isConstruction = false
        }
      })
    },

    getContractStartDate(value) {
      var d1 = new Date(value)
      var year = d1.getFullYear() //年
      var month = d1.getMonth() + 1 //月
      var day = d1.getDate() //日

      if (month < 10) {
        month = '0' + month
      }
      if (day < 10) {
        day = '0' + day
      }

      this.startDate = year + '-' + month + '-' + day
      this.form.contractStartDate = year + '-' + month + '-' + day

      if (this.form.contractEndDate != '' || this.form.contractEndDate != undefined) {
        this.endDate = this.form.contractEndDate
      }
      if (this.endDate != '' && this.endDate != undefined) {
        let startTime = new Date(this.startDate)
        let endTime = new Date(this.endDate)

        if (startTime > endTime) {
          this.$message.error('开工日期不能大于竣工日期！')
          this.form.contractStartDate = undefined
          return
        } else {
          let iDays = parseInt(Math.abs(endTime.getTime() - startTime.getTime()) / 1000 / 60 / 60 / 24)
          this.form.contractDays = iDays
        }
      }
    },

    getContractEndDate(value) {
      console.log('gjgsaf:', value)
      var d1 = new Date(value)
      var year = d1.getFullYear() //年
      var month = d1.getMonth() + 1 //月
      var day = d1.getDate() //日

      if (month < 10) {
        month = '0' + month
      }
      if (day < 10) {
        day = '0' + day
      }

      this.endDate = year + '-' + month + '-' + day
      this.form.contractEndDate = year + '-' + month + '-' + day

      if (this.form.contractStartDate != '' || this.form.contractStartDate != undefined) {
        this.startDate = this.form.contractStartDate
      }

      if (this.startDate != '' && this.startDate != undefined) {
        var startTime = new Date(this.startDate)
        var endTime = new Date(this.endDate)

        if (endTime < startTime) {
          this.$message.error('竣工日期不能小于开工日期！')
          this.form.contractEndDate = undefined
          return
        } else {
          let iDays = parseInt(Math.abs(endTime.getTime() - startTime.getTime()) / 1000 / 60 / 60 / 24)
          this.form.contractDays = iDays
        }
      }
    },

    getProjectManager() {
      getOrgUsers(this.queryData).then((res) => {
        console.log('返回人员数据：', res.data)
        this.projectManagers = res.data
      })
    },

    getManagerName(value) {
      this.projectManagerCodeName = value.label
    },

    saveInfo() {
      // 提交立项基本信息
      if (this.loading) {
        return
      }
      this.loading = true
      this.$refs.form1.validate(() => {
        // this.form.contractDays = this.countDate
        if (this.projectId != '') {
          this.form.projectId = this.projectId
        }
        this.form.isSubmit = false
        addProjectsInfo(this.form)
          .then((res) => {
            this.loading = false
            if (res.code === 200) {
              this.projectId = res.data.projectId
              localStorage.setItem('projectId', res.data.projectId)
              this.$message.success('提交成功！')
              this.nextSteps = '2'
              this.$multiTab.close(this.$route.fullpath)
            } else {
              this.$message.error('提交失败！')
            }
          })
          .catch(() => (this.loading = false))
      })
    }
  }
}
</script>

<style lang="less" scoped>
.requireRed {
  color: red;
}
/deep/ .ant-form-item label {
  font-size: 12px;
}
</style>

